
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using GruntXProductions;
using Viper;
using Viper.Opcodes;

namespace Diamond
{
	public class SyntaxNode
	{
	}
	public class DiamondObject
	{
		public List<Field> Fields = new List<Field>();
	}
	public class DiamondClass : SyntaxNode
	{
		public string Name;
		public string Extends = "";
		public List<Declaration> Field = new List<Declaration>();
		public List<Method> Functions = new List<Method>();
	}
	public class OperatorOverload : SyntaxNode
	{
		public string theOperator;
		public List<Declaration> Arguments = new List<Declaration>();
		public string Type;
		public CodeBlock Body;
	}
	public class Method : SyntaxNode
	{
		public string Name;
		public List<Declaration> Arguments = new List<Declaration>();
		public string Type;
		public CodeBlock Body;
	}
	public class IntLiteral : SyntaxNode
	{
		public uint Value;
		public IntLiteral(uint val)
		{
			this.Value = val;
		}
	}
	public class IfStatement : SyntaxNode
	{
		public CodeBlock Body;
		public CodeBlock Else = new CodeBlock();
		public Expression Comparison;
	}
	public class ForStatement : SyntaxNode
	{
		public CodeBlock Body;
		public Declaration Declaration;
		public Expression Comparison;
		public SyntaxNode Step;
	}
	public class WhileStatement : SyntaxNode
	{
		public CodeBlock Body;
		public Expression Comparison;
	}
	public class StringLiteral : SyntaxNode
	{
		public string Value;
		public StringLiteral(string val) {
			this.Value = val;	
		}
	}
	public class SymbolRef : SyntaxNode
	{
		public string Value;
		public SymbolRef(string val) {
			this.Value = val;	
		}
	}
	public class CodeBlock : SyntaxNode
	{
		public List<SyntaxNode> Body = new List<SyntaxNode>();
	}
	public class Field : Declaration
	{
		public bool Public;
		public bool Static;
		public Field(string Name, string Type, Expression exp) : base(Name, Type, exp)
		{
			this.Name = Name;
			this.Type = Type;
			this.Value = exp;
		}
		public Field(string Name, string Type) :  base(Name, Type)
		{
			this.Name = Name;
			this.Type = Type;
		}
	}
	public class Assignment : SyntaxNode
	{
		public string Name;
		public Expression Value = new Expression();
	}
	public class Return : SyntaxNode
	{
		public Expression Value = new Expression();
	}
	public class Declaration : SyntaxNode
	{
		public string Name;
		public string Type;
		public Expression Value = new Expression();
		public Declaration(string Name, string Type, Expression exp)
		{
			this.Name = Name;
			this.Type = Type;
			this.Value = exp;
		}
		public Declaration(string Name, string Type)
		{
			this.Name = Name;
			this.Type = Type;
		}
	}
	public class FunctionCall : SyntaxNode
	{
		public string Target;
		public List<Expression> Arguments = new List<Expression>();
	}
	public class Expression : SyntaxNode
	{
		public List<SyntaxNode> Items = new List<SyntaxNode>();
	}
	public class ExternalMethod : Method
	{
		
	}
	public class Operator : SyntaxNode
	{
		public string theOperator;
		public SyntaxNode Op1, Op2;
	}
	public class Break : SyntaxNode {}
	public class Ref : SyntaxNode { public string Symbol; }
	public class InlineIL : SyntaxNode
	{
		public string IL_Code = "";
	}
	public class Plus : Operator { public Plus() { this.theOperator = "+" ;}}
	public class Equal : Operator {public Equal() { this.theOperator = "==" ;}} 
	public class NotEqual : Operator { public NotEqual() { this.theOperator = "!=" ;}}
	public class Multiply : Operator { public Multiply() { this.theOperator = "*" ;}}
	public class GreaterThan : Operator { public GreaterThan() { this.theOperator = ">" ;}}
	public class LessThan : Operator { public LessThan() { this.theOperator = "<" ;}}
	public class Subtract : Operator { public Subtract() { this.theOperator = "-" ;}}
	public class And : Operator { public And() { this.theOperator = "&&" ;}}
	public class Divide : Operator { }
	public class LeftBitshift : Operator { }
	public class RightBitshift : Operator { public override string ToString() { return ">>"; } }
}